<style type="text/css">
    .hide{display: none;}
    #city-box,#area-box{margin-top: 10px;}
    .tag-box{margin: 10px 0px;}
    .clear{clear: both;}
    .laydate-time-list{padding-bottom:0;overflow:hidden}
    .laydate-time-list>li{width:50%!important;}
    .laydate-time-list>li:last-child { display: none;}
    .layui-word-aux{padding-left: 35px !important;}
    .layui-btn-group{margin-bottom: 8px;}
</style>
<script>
    var baseUrl = "<?php echo $baseUrl; ?>?t=1";
</script>

<div class="layui-row search-row" id="search-box">
    <div class="item">
        <div class="row" style="width: 330px">
            <div class="box">
                <span class="title">状态：</span>
                <div data-key="is_status" data-type="list" class="search-key list" >
                    <ul>
                        <li><span data-value="1">正常</span></li>
                        <li><span data-value="2">停用</span></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div class="item">
        <div class="row" style="width: 330px">
            <div class="box">
                <span class="title">是否热门：</span>
                <div data-key="is_hot" data-type="list" class="search-key list" >
                    <ul>
                        <li><span data-value="1">是</span></li>
                        <li><span data-value="2">否</span></li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div class="item">
        <div class="row" style="width: 430px">
            <div class="box">
                <span class="title">地区：</span>
                <div  data-key="scity" data-type="select" class="txt search-key" style="float: left;">
                    <select name="scity" lay-filter="scity" class="select">
                        <option value="0">请选择</option>
                        <?php if(isset($allscity)){
                            foreach ($allscity as $key => $value) { ?>
                                <option value="<?php echo $value['code']; ?>"> <?php echo $value['name']; ?> </option>
                            <?php }
                        }  ?>
                    </select>
                </div>
                <div style="float: left;margin-right: 17px;">~</div>
                <div data-key="ecity" data-type="select" class="txt search-key" style="float: left;">
                    <select name="ecity" lay-filter="ecity" class="select">
                        <option value="0">请选择</option>
                        <?php if (isset($allecity)){
                            foreach ($allecity as $key => $value) { ?>
                                <option value="<?php echo $value['code']; ?>"> <?php echo $value['name']; ?> </option>
                            <?php }
                        }  ?>
                    </select>
                </div>
            </div>
        </div>
    </div>
    <div class="item">
        <div class="row" style="width: 430px">
            <div class="box">
                <span class="title">上下车地址：</span>
                <div  data-key="ssite" data-type="select" class="txt search-key" style="float: left;">
                    <select name="ssite" lay-filter="ssite" class="select">
                        <option value="0">请选择</option>
                        <?php foreach ($allssite as $key => $value) { ?>
                            <option value="<?php echo $value['id']; ?>"> <?php echo $value['name']; ?> </option>
                        <?php } ?>
                    </select>
                </div>
                <div style="float: left;margin-right: 17px;">~</div>
                <div data-key="esite" data-type="select" class="txt search-key" style="float: left;">
                    <select name="esite" lay-filter="esite" class="select">
                        <option value="0">请选择</option>
                        <?php foreach ($allesite as $key => $value) { ?>
                            <option value="<?php echo $value['id']; ?>"> <?php echo $value['name']; ?> </option>
                        <?php } ?>
                    </select>
                </div>
            </div>
        </div>
    </div>
    <div class="item">
        <div class="row" style="width: 360px;">
            <div class="box">
                <span class="title">关键字查询：</span>
                <div data-key="key" data-type="txt" class="search-key txt">
                    <input type="text" value="" placeholder="线路名称"/>
                </div>
            </div>
        </div>
        <div class="row" style="width: 460px;">
            <div class="btn">
                <button class="layui-btn layui-btn-sm btn-query">查询</button>

                <?php if(Cm::$app->limitGet('/platform/site/index')){ ?>
                    <a href="<?php echo \yii\helpers\Url::to(['site/index'])?>" class="layui-btn layui-btn-normal layui-btn-sm">站点管理</a>
                <?php } ?>
                <?php if(Cm::$app->limitPost('/platform/circuit/index','save')){ ?>
                    <a href="javascript:void(0)" class="layui-btn layui-btn-primary layui-btn-sm" onclick="app.edit.add()">+ 新增线路</a>
                <?php } ?>
            </div>
        </div>
    </div>
</div>
<table data-url="<?php echo $baseUrl; ?>?action=list"
       data-search="#search-box"
       data-page=""
       data-height="full-360"
       id="data-list"
       lay-filter='data-list' style="display: none;">
    <thead>
    <tr>
        <th width="130" field="serial_number">编码</th>
        <th width="250" field="name">线路名称</th>
        <th width="130" field="tags">线路标签</th>
        <th minWidth="130" field="s_address">上车地址</th>
        <th minWidth="130" field="e_address">下车地址</th>
        <th width="100" align="center" style="color: red;" field="ordernum">有效订单</th>
        <th width="100" align="center" style="color: red;" field="passengernum">有效乘客</th>
        <!-- <th width="110" field="earea">终点地区</th>
        <th width="110" field="esite">终点站点</th> -->
        <th width="60" align="center" field="duration">时长</th>
        <th width="60" align="center" field="mileage">公里</th>
        <th width="60" align="center" templet="#tpl-hot">热门</th>
        <th width="60" align="center" templet="#tpl-status">状态</th>
        <th fixed="right" minWidth="430" align="center" toolbar="#tpl-cmd">操作</th>
    </tr>
    </thead>
</table>

<script type="text/html" id="tpl-status">
    {{# if(d.status==1){}}
    <span style="color: green;">正常</span>
    {{# }else{}}
    <span style="color: red;">停用</span>
    {{# }}}
</script>

<script type="text/html" id="tpl-hot">
    {{# if(d.is_hot==1){ }}
    <span style="color: red;"><i class="layui-icon layui-icon-fire"></i></span>
    {{# } }}
</script>

<script type="text/html" id="tpl-cmd">
    <?php if(Cm::$app->limitPost('/platform/circuit/index','info')){ ?>
        <button onclick="app.edit.update(this)" class="layui-btn layui-btn-xs">编辑</button>
    <?php } ?>
    <?php if(Cm::$app->limitPost('/platform/circuit/index','tag_info')){ ?>
        <button onclick="app.tag.info({{d.id}})" class="layui-btn layui-btn-xs">标签管理</button>
    <?php } ?>
    <?php if(Cm::$app->limitPost('/platform/circuit/index','state')){ ?>
        <button onclick="app.state({{d.id}},{{d.status}})" class="layui-btn {{d.status==1?'layui-btn-danger':''}} layui-btn-xs">{{d.status==1?'停用':'启用'}}</button>
    <?php } ?>

    <?php if(Cm::$app->limitPost('/platform/shift/index','save')){ ?>
        <button onclick="app.shift.add({{d.id}},'{{d.name}}')"  class="layui-btn layui-btn-xs">排班</button>
    <?php } ?>
    <?php if(Cm::$app->limitGet('/platform/shift/index')){ ?>
        <a href="<?php echo $shiftUrl; ?>?circuit_id={{d.id}}" target="_blank" class="layui-btn layui-btn-xs">班次查询</a>
    <?php } ?>

    <?php if(Cm::$app->limitPost('/platform/circuit/index','order')){ ?>
        <button onclick="app.order({{d.id}})" class="layui-btn layui-btn layui-btn-normal layui-btn-xs">订单统计</button>
    <?php } ?>

    <?php if(Cm::$app->limitPost('/platform/circuit/index','del')){ ?>
        <button onclick="app.del({{d.id}})" class="layui-btn layui-btn layui-btn-danger layui-btn-xs">删除</button>
    <?php } ?>

    <span style="display: none;">{{JSON.stringify(d)}}</span>
</script>

<script type="text/html" id="tpl-edit">
    <div class="layui-card" style="height: calc(100% - 60px); overflow-y: auto;">
        <div class="layui-card-header">{{id>0?'编辑线路':'新增线路'}}</div>
        <div class="layui-card-body">
            <form class="layui-form" action="">
                <div class="layui-form-item">
                    <label class="layui-form-label">起始地区</label>
                    <div class="layui-input-block">
                        <select lay-filter="s_province" lay-search id="s_province">
                            <option value="">请选择</option>
                            <?php foreach ($allSite as $key => $value) { ?>
                                <option value="<?php echo $value['city_code'] ?>"><?php echo $value['full_name']; ?></option>
                            <?php } ?>
                        </select>
                    </div>
                    <div class="layui-input-block hide" id="s-city-box" style="margin-top: 10px;">

                    </div>
                    <div class="layui-input-block hide" id="s-area-box" style="margin-top: 10px;">

                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">起始站点</label>
                    <div class="layui-input-block" id="s_site_box">
                        <select lay-filter="s_site" id="s_site">
                            <option value="" data-code="">请选择</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">上车点</label>
                    <div class="layui-input-block">
                        <input type="text" name="s_address"  value="{{s_address}}" lay-verify="required"  autocomplete="off" placeholder="请输入上车的地址" class="layui-input">
                    </div>
                    <a  class="layui-btn layui-btn-xs" onclick="app.get_on()"   >添加途径点</a>
                    <div id="get_on">

                    </div>

                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">终点地区</label>
                    <div class="layui-input-block">
                        <select lay-filter="e_province" lay-search id="e_province">
                            <option value="">请选择</option>
                            <?php foreach ($allSite as $key => $value) { ?>
                                <option value="<?php echo $value['city_code'] ?>"><?php echo $value['full_name']; ?></option>
                            <?php } ?>
                        </select>
                    </div>
                    <div class="layui-input-block hide" id="e-city-box" style="margin-top: 10px;">

                    </div>
                    <div class="layui-input-block hide" id="e-area-box" style="margin-top: 10px;">

                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">终点站点</label>
                    <div class="layui-input-block" id="e_site_box">
                        <select lay-filter="e_site" id="e_site">
                            <option value="" data-code="">请选择</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">下车点</label>
                    <div class="layui-input-block">
                        <input type="text" name="e_address" id="e_address" value="{{e_address}}" lay-verify="required"  autocomplete="off" placeholder="请输入下车的地址" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">线路名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" id="name" value="{{name}}" lay-verify="required"  autocomplete="off" placeholder="请输入线路名称" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">编码</label>
                    <div class="layui-input-block">
                        <input type="text" name="serial_number" id="serial_number" value="{{serial_number}}" lay-verify="required"  autocomplete="off" placeholder="请输入编码" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">路线时长</label>
                    <div class="layui-input-block">
                        <input type="text" name="duration" id="duration" value="{{duration}}" lay-verify="required"  autocomplete="off" placeholder="请输入路线时长" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">公里数</label>
                    <div class="layui-input-block">
                        <input type="text" name="mileage" id="mileage" value="{{mileage}}" lay-verify="required"  autocomplete="off" placeholder="请输入路线公里数" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">是否热门</label>
                    <div class="layui-input-block">
                        <input type="checkbox" lay-filter="is_hot" name="is_hot" lay-skin="switch" lay-text="ON|OFF" {{is_hot==1?'checked':''}}>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">分销状态</label>
                    <div class="layui-input-block">
                        <input type="checkbox" lay-filter="rebate_status" name="rebate_status" lay-skin="switch" lay-text="ON|OFF" {{rebate_status==1?'checked':''}}>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">分销类型</label>
                    <div class="layui-input-block">
                        <input type="radio" name="rebate_type" value="1" title="售价比例" {{rebate_type==1?'checked':''}}>
                        <input type="radio" name="rebate_type" value="2" title="金额" {{rebate_type==2?'checked':''}}>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">{{rebate_type==1?'售价比例':'金额'}}</label>
                    <div class="layui-input-block">
                        <input type="number" name="rebate" lay-verify="required|price"  value="{{rebate}}" autocomplete="off" placeholder="请输入订单分销金额或比例"
                               class="layui-input basesys"
                               min="0.1" max="100" step="0.1" onkeyup ="value=value.replace(/^(\d*\.?\d{0,2}).*/,'$1')"
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">启用状态</label>
                    <div class="layui-input-block">
                        <input type="checkbox" lay-filter="status" name="status" lay-skin="switch" lay-text="ON|OFF" {{status==1?'checked':''}}>
                    </div>
                </div>
                <?php if(Cm::$app->limitPost('/platform/circuit/index','save')){ ?>
                    <div class="layui-form-item">
                        <label class="layui-form-label"></label>
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit="" lay-filter="*">保存</button>
                        </div>
                    </div>
                <?php } ?>
            </form>
        </div>
    </div>
</script>

<script type="text/html" id="tpl-area">
    <select lay-filter="{{type}}" lay-search id="{{type}}">
        <option value="">请选择</option>
        {{each item.data as value index}}
        <option value="{{value.city_code}}">{{value.full_name}}</option>
        {{/each}}
    </select>
</script>

<script type="text/html" id="tpl-site">
    <select lay-filter="{{type}}" id="{{type}}">
        <option value="">请选择</option>
        {{each item.site as value index}}
        <option value="{{value.siteid}}" data-code="{{value.code}}">{{value.sitename}}</option>
        {{/each}}
    </select>
</script>

<script type="text/html" id="tpl-tag">
    <div class="layui-card" style="box-shadow: none;">
        <div class="layui-card-header">标签管理</div>
        <div class="layui-card-body">
            <?php if(Cm::$app->limitPost('/platform/circuit/index','tag_save')){ ?>
                <div class="btn">
                    <a href="javascript:void(0)" class="layui-btn layui-btn-primary layui-btn-sm" onclick="app.tag.edit(0,{{circuit_id}})">+ 新增标签</a>
                </div>
            <?php } ?>
            <div class="tag-box"></div>
        </div>
    </div>
</script>

<script type="text/html" id="tpl-tag-list">
    {{each item as value}}
    <div class="layui-btn-group">
        <a href="javascript:void(0)" class="layui-btn layui-btn-primary layui-btn-sm" <?php if(Cm::$app->limitPost('/platform/circuit/index','tag_save')){ ?> onclick="app.tag.edit({{value.id}},{{value.circuit_id}})" <?php } ?> >{{value.name}}</a>
        <?php if(Cm::$app->limitPost('/platform/circuit/index','tag_del')){ ?>
            <a href="javascript:void(0)" class="layui-btn layui-btn-sm layui-btn-danger" onclick="app.tag.del({{value.id}})">
                <i class="layui-icon layui-icon-delete"></i>
            </a>
        <?php } ?>
    </div>
    {{/each}}
</script>

<script type="text/html" id="tpl-tag-save">
    <div class="layui-card" style="box-shadow: none;">
        <div class="layui-card-header">{{id>0?'编辑标签':'新增标签'}}</div>
        <div class="layui-card-body">
            <form class="layui-form" action="">
                <div class="layui-form-item">
                    <label class="layui-form-label">标签名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" value="{{name}}" lay-verify="required"  autocomplete="off" placeholder="请输入标签名称" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">排序</label>
                    <div class="layui-input-block">
                        <input type="text" name="sort" value="{{sort}}" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <?php if(Cm::$app->limitPost('/platform/circuit/index','tag_save')){ ?>
                    <div class="layui-form-item">
                        <label class="layui-form-label"></label>
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit="" lay-filter="tag">保存</button>
                        </div>
                    </div>
                <?php } ?>
            </form>
        </div>
    </div>
</script>


<script type="text/html" id="tpl-moretime">
    <div class="moretime_box layui-btn-group">
        <a href="javascript:void(0)" class="layui-btn layui-btn-primary layui-btn-sm">{{time}}</a>
        <a href="javascript:void(0)" class="layui-btn layui-btn-sm layui-btn-danger" onclick="app.shift.delmoretime(this,'{{time}}')">
            <i class="layui-icon layui-icon-delete"></i>
        </a>
    </div>
</script>

<script type="text/html" id="tpl-shift-add">
    <div class="layui-card" style="box-shadow: none;">
        <div class="layui-card-header">{{name}}排班</div>
        <div class="layui-card-body">
            <form class="layui-form" action="">
                <div class="layui-form-item">
                    <div class="layui-col-md4">
                        <label class="layui-form-label">班次类型</label>
                        <div class="layui-input-inline">
                            <select lay-filter="shift_type" id="shift_type">
                                <option value="">请选择</option>
                                <option value="1">固定班次</option>
                                <option value="2">流水班次</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-col-md4">
                        <label class="layui-form-label">车型</label>
                        <div class="layui-input-inline">
                            <select lay-filter="models_id" id="models_id">
                                <option value="">请选择</option>
                                <?php foreach ($carModels as $key => $value) { ?>
                                    <option value="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></option>
                                <?php } ?>
                            </select>
                        </div>
                    </div>
                    <div class="layui-col-md4">
                        <label class="layui-form-label">检票员</label>
                        <div class="layui-input-inline">
                            <select lay-filter="inspector" id="inspector">
                                <option value="">请选择</option>
                                <?php foreach ($allInspector as $key => $value) { ?>
                                    <option value="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></option>
                                <?php } ?>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-col-md4">
                        <label class="layui-form-label">发车日期</label>
                        <div class="layui-input-inline">
                            <input type="text" name="departureday" lay-verify="required" id="departureday" placeholder="yyyy-MM-dd至yyy-MM-dd" class="layui-input" readonly="readonly">
                        </div>
                        <div class="layui-form-mid layui-word-aux"></div>
                    </div>
                    <div class="layui-col-md8">
                        <label class="layui-form-label">发车时间</label>
                        <div class="layui-input-inline">
                            <input type="text" name="departuretime" id="departuretime" class="layui-input" readonly="readonly">
                        </div>
                        <div class="layui-form-mid layui-word-aux">可选择多个时间段,如果是2个不同的日期就表示这 期间每天的多个时段都设置班次</div>
                    </div>
                </div>

                <div class="layui-form-item allmoretimebox hide">
                    <label class="layui-form-label">多个时段</label>
                    <div class="layui-input-block moretimebox">

                    </div>
                </div>

                <!--                途径点发车时段-->
                <div  id="point_address">

                </div>

                <div class="layui-form-item">
                    <div class="layui-col-md4">
                        <label class="layui-form-label" >开始预售</label>
                        <div class="layui-input-inline">
                            <input type="text" name="presaletime" value="{{item.presaletime}}" class="layui-input" lay-verify="required|intnumber" id="presaletime" >
                        </div>
                        <div class="layui-form-mid layui-word-aux">发车前多少小时开始预售</div>
                    </div>
                    <div class="layui-col-md4">
                        <label class="layui-form-label" >开始停售</label>
                        <div class="layui-input-inline">
                            <input type="text" name="closingtime" value="{{item.closingtime}}" class="layui-input" lay-verify="required|intnumber" id="closingtime">
                        </div>
                        <div class="layui-form-mid layui-word-aux">发车前多少分钟开始停售</div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-col-md4">
                        <label class="layui-form-label">票价</label>
                        <div class="layui-input-inline">
                            <input type="text" name="ticket_price" value="{{item.ticket_price}}" lay-verify="required|price" placeholder="请输入票价" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux"></div>
                    </div>
                    <div class="layui-col-md4">
                        <label class="layui-form-label">可售票数</label>
                        <div class="layui-input-inline">
                            <input type="text" name="a_ticket" value="{{item.a_ticket}}" lay-verify="required|intzeronumber" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux">0为无限制票数</div>
                    </div>
                    <div class="layui-col-md4">
                        <label class="layui-form-label">余票</label>
                        <div class="layui-input-inline">
                            <input type="text" name="s_ticket" value="{{item.s_ticket}}" lay-verify="intzeronumber" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux"></div>
                    </div>

                </div>
                <div class="layui-form-item">
                    <div class="layui-col-md4">
                        <label class="layui-form-label">起订人数</label>
                        <div class="layui-input-inline">
                            <input type="text" name="min" value="{{item.min}}" lay-verify="required|intnumber" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux">每单每单最少添加乘客数</div>
                    </div>
                    <div class="layui-col-md4">
                        <label class="layui-form-label">限制人数</label>
                        <div class="layui-input-inline">
                            <input type="text" name="max" value="{{item.max}}" lay-verify="intzeronumber" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux">每人每单最多添加乘客数；0：无限制</div>
                    </div>
                    <div class="layui-col-md4">
                        <label class="layui-form-label">车辆数</label>
                        <div class="layui-input-inline">
                            <input type="text" name="carnum" value="{{item.carnum}}" lay-verify="intzeronumber" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux"></div>
                    </div>
                </div>

                <?php if(Cm::$app->limitPost('/platform/shift/index','save')){ ?>
                    <div class="layui-form-item">
                        <label class="layui-form-label"></label>
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit="" lay-filter="shift">保存</button>
                        </div>
                    </div>
                <?php } ?>
            </form>
        </div>
    </div>
</script>
<script type="text/html" id="tpl-order">
    <div id="order-box"></div>
</script>
<script src="<?php echo RES_URL ?>/res/js/echars/echarts.min.js"></script>
<script>
    var currPage=1;
    var i=1;
    var point_address_data={};
    var app = {
        allSite:'<?php echo json_encode($allSite); ?>',
        site_data:$.parseJSON('<?php echo json_encode($SiteData); ?>'),
        province:[],
        s_city:[],
        s_area:[],
        e_city:[],
        e_area:[],
        point_address:[],
        point_address_s:[],
        address:[],
        init: function () {
            $('#data-list').table();
            this.form.init();
            this.laydate.init();
        },
        edit: {
            data:null,
            load: function () {
                app.province = app.province.length == 0 ? eval('('+app.allSite+')') : app.province;
                if(app.province.length == 0){
                    layer.msg("请先添加站点", {icon: 5});
                    return false;
                }
                layer.open({
                    title:false,
                    area:['60%','80%'],
                    shadeClose: true, // 点击遮罩关闭
                    shade: 0.8, // 遮罩的透明度
                    type:1,
                    content:template('tpl-edit', this.data),

                    btn:['取消'],//多个按钮直接用btn1/btn2/btn3...回调
                    // area : ['85%' , '95%'],
                    // content:"<div style='font-size: 15px'>展示文字</div>",
                    btn1:function (index, layero) {//这里也可以用btn1替代yes
                        layer.close(index)
                    }
                });
                for (const Key in this.data.address) {
                    i++;
                    var option='';
                    for (const key in app.site_data) {
                        if(this.data.address[Key]==app.site_data[key].id){
                            option+='<option selected data-site="'+app.site_data[key].id+'" value="'+app.site_data[key].id+'">'+app.site_data[key].name+'</option>';
                        }else {
                            option+='<option  data-site="'+app.site_data[key].id+'" value="'+app.site_data[key].id+'">'+app.site_data[key].name+'</option>';
                        }
                    }
                    var html='<div class="layui-input-block" id="get_one_'+i+'">'+
                        '<select name="point_address['+i+']" lay-verify="required" lay-search >'+
                        '<option value="">请选择一个站点</option>'+
                        option+
                        '</select>'+
                        '<input type="text" name="point_address_s['+i+']"  value="'+this.data.point_address[Key]['address']+'" lay-verify="required"  autocomplete="off" placeholder="请输入途径点上车的地址" class="layui-input">'+
                        '<a  class="layui-btn layui-btn-xs get_del" onclick="app.get_del('+i+')"  >删除途径点</a>'+
                        '<em style="color: red">不可再次编辑,如需修改直接移除再次添加即可</em>'+
                        '</div>';

                    $('#get_on').append(html);
                }

                if(app.edit.data.site_sid != 0){
                    app.edit.area('s',app.edit.data.site_sid,app.edit.data.scode);
                }
                if(app.edit.data.site_eid != 0){
                    app.edit.area('e',app.edit.data.site_eid,app.edit.data.ecode);
                }
                app.form.render();
            },
            area:function(type,id,arr){
                if(arr.length == 0){
                    return false;
                }
                $("#"+type+"_province").val(arr[0]);
                var city = app.province[arr[0]];
                if(city.data == ''){
                    app.edit.site(type,id,city);
                    app.form.render();
                    return false;
                }
                if(type == 's'){
                    app.s_city = city;
                }else{
                    app.e_city = city;
                }
                $("#"+type+"-city-box").html(template('tpl-area',{item:city,type:type+'_city'}));
                app.form.render();
                $("#"+type+"-city-box").show();
                if(arr.length == 1 ){
                    $("#"+type+"_city").val(arr[0]);
                    app.edit.site(type,id,city.data[arr[0]]);
                    app.form.render();
                    return false;
                }
                var area = city.data[arr[1]];
                $("#"+type+"_city").val(arr[1]);
                if(area.data == ""){
                    app.edit.site(type,id,area);
                    app.form.render();
                    return false;
                }
                if(type == 's'){
                    app.s_area = area;
                }else{
                    app.e_area = area;
                }
                $("#"+type+"-area-box").html(template('tpl-area',{item:area,type:type+'_area'}));
                app.form.render();
                $("#"+type+"-area-box").show();
                if(arr.length == 2){
                    $("#"+type+"_area").val(arr[1]);
                    app.edit.site(type,id,area.data[arr[1]]);
                    app.form.render();
                    return false;
                }
                $("#"+type+"_area").val(arr[2]);
                app.edit.site(type,id,area.data[arr[2]]);
                app.form.render();
            },
            site:function(type,id,item){
                $("#"+type+"_site_box").html(template('tpl-site',{item:item,type:type+'_site'}));
                app.form.render();
                $("#"+type+"_site").val(id);
            },
            add: function () {
                this.data={
                    id:0,
                    name:'',
                    serial_number:'',
                    e_address:'',
                    s_address:'',
                    point_address:[],
                    point_address_s:[],
                    duration:'',
                    mileage:'',
                    city_scode:0,
                    site_sid:0,
                    city_ecode:0,
                    site_eid:0,
                    is_hot:0,
                    status:1,
                    rebate_status:0,
                    rebate_type:1,
                    rebate:0,
                };

                this.load();
            },
            update: function (e) {
                var str=$(e).parent().find('span').html();
                var json=eval('('+str+')');
                this.data={
                    id:json.id,
                    name:json.name,
                    serial_number:json.serial_number,
                    e_address:json.e_address,
                    s_address:json.s_address,
                    point_address:json.point_address,
                    point_address_s:json.point_address_s,
                    duration:json.duration,
                    mileage:json.mileage,
                    city_ecode:json.city_ecode,
                    ecode:json.ecode,
                    site_eid:json.site_eid,
                    city_scode:json.city_scode,
                    scode:json.scode,
                    site_sid:json.site_sid,
                    is_hot:json.is_hot,
                    status:json.status,
                    address:json.address,
                    rebate_status:json.rebate_status,
                    rebate_type:json.rebate_type,
                    rebate:json.rebate,
                };
                this.load();
            }
        },
        form: {
            obj: null,
            init: function () {
                var form = layui.form;
                form.verify({
                    intnumber: [
                        /^([1-9]|[1-9]\d+)$/
                        , '请填写大于0的整数！'
                    ],
                    intzeronumber:[
                        /^([0-9]|[1-9]\d+)$/
                        , '请填写大于等于0的整数！'
                    ],
                    price:[
                        /(^[1-9](\d+)?(\.\d{1,2})?$)|(^0$)|(^\d\.\d{1,2}$)/
                        , '请填写大于0的2位小数！'
                    ]
                });
                form.render();

                form.on('switch(is_hot)', function (data) {
                    app.edit.data.is_hot=data.elem.checked ? 1 : 0;
                });

                form.on('switch(rebate_status)', function (data) {
                    app.edit.data.rebate_status=data.elem.checked ? 1 : 0;
                });

                form.on('switch(status)', function (data) {
                    app.edit.data.status=data.elem.checked ? 1 : 0;
                });
                form.on('select(s_province)',function(data){
                    app.edit.data.city_scode = 0;
                    app.edit.data.site_sid = 0;
                    $("#s-city-box").hide();
                    $("#s-area-box").hide();
                    $("#s_site_box").html(template('tpl-site',{item:[],type:'s_site'}));
                    $("#s-city-box").html(template('tpl-area',{item:[],type:'s_city'}));
                    $("#s-area-box").html(template('tpl-area',{item:[],type:'s_area'}));
                    if(data.value == ''){
                        app.form.render();
                        return false;
                    }
                    app.s_city = app.province[data.value];
                    if(app.s_city.site.length>0){
                        $("#s_site_box").html(template('tpl-site',{item:app.s_city,type:'s_site'}));
                    }
                    if(app.s_city.data == 0){
                        app.form.render();
                        return false;
                    }
                    $("#s-city-box").show();
                    $("#s-city-box").html(template('tpl-area',{item:app.s_city,type:'s_city'}));
                    app.form.render();
                });

                form.on('select(s_city)',function(data){
                    app.edit.data.site_sid = 0;
                    app.edit.data.city_scode = 0;
                    $("#s-area-box").hide();
                    $("#s-area-box").html(template('tpl-area',{item:[],type:'s_area'}));
                    $("#s_site_box").html(template('tpl-site',{item:[],type:'s_site'}));
                    if(data.value == ''){
                        app.form.render();
                        return false;
                    }
                    app.s_area = app.s_city.data[data.value];
                    if(app.s_area.site.length>0){
                        $("#s_site_box").html(template('tpl-site',{item:app.s_area,type:'s_site'}));
                    }
                    if(app.s_area.data == 0){
                        app.form.render();
                        return false;
                    }
                    $("#s-area-box").show();
                    $("#s-area-box").html(template('tpl-area',{item:app.s_area,type:'s_area'}));
                    app.form.render();
                });

                form.on('select(s_area)',function(data){
                    app.edit.data.city_scode = 0;
                    app.edit.data.site_sid = 0;
                    if(data.value == ''){
                        $("#s_site_box").html(template('tpl-site',{item:[],type:'s_site'}));
                    }else{
                        $("#s_site_box").html(template('tpl-site',{item:app.s_area.data[data.value],type:'s_site'}));
                    }
                    app.form.render();
                });

                form.on('select(s_site)',function(data){
                    if(data.value == ''){
                        app.edit.data.city_scode = 0;
                        app.edit.data.site_sid = 0;
                    }else{
                        app.edit.data.city_scode = $(data.elem).find("option[value='"+data.value+"']").attr('data-code');;
                        app.edit.data.site_sid = data.value;
                    }
                });

                form.on('select(e_province)',function(data){
                    app.edit.data.city_ecode = 0;
                    app.edit.data.site_eid = 0;
                    $("#e-city-box").hide();
                    $("#e-area-box").hide();
                    $("#e_site_box").html(template('tpl-site',{item:[],type:'e_site'}));
                    $("#e-city-box").html(template('tpl-area',{item:[],type:'s_city'}));
                    $("#e-area-box").html(template('tpl-area',{item:[],type:'s_area'}));
                    if(data.value == ''){
                        app.form.render();
                        return false;
                    }
                    app.e_city = app.province[data.value];
                    if(app.e_city.site.length>0){
                        $("#e_site_box").html(template('tpl-site',{item:app.e_city,type:'e_site'}));
                    }
                    if(app.e_city.data == ''){
                        app.form.render();
                        return false;
                    }
                    $("#e-city-box").show();
                    $("#e-city-box").html(template('tpl-area',{item:app.e_city,type:'e_city'}));
                    app.form.render();
                });

                form.on('select(e_city)',function(data){
                    app.edit.data.site_eid = 0;
                    app.edit.data.city_ecode = 0;
                    $("#e-area-box").hide();
                    $("#e_site_box").html(template('tpl-site',{item:[],type:'e_site'}));
                    $("#e-area-box").html(template('tpl-area',{item:[],type:'e_area'}));
                    if(data.value == ''){
                        app.form.render();
                        return false;
                    }
                    app.e_area = app.e_city.data[data.value];
                    if(app.e_area.site.length>0){
                        $("#e_site_box").html(template('tpl-site',{item:app.e_area,type:'e_site'}));
                    }
                    if(app.e_area.data == ''){
                        app.form.render();
                        return false;
                    }
                    $("#e-area-box").show();
                    $("#e-area-box").html(template('tpl-area',{item:app.e_area,type:'e_area'}));
                    app.form.render();
                });

                form.on('select(e_area)',function(data){
                    app.edit.data.city_ecode = 0;
                    app.edit.data.site_eid = 0;
                    if(data.value == ''){
                        $("#e_site_box").html(template('tpl-site',{item:[],type:'e_site'}));
                    }else{
                        $("#e_site_box").html(template('tpl-site',{item:app.e_area.data[data.value],type:'e_site'}));
                    }
                    app.form.render();
                });

                form.on('select(e_site)',function(data){
                    if(data.value == ''){
                        app.edit.data.city_ecode = 0;
                        app.edit.data.site_eid = 0;
                    }else{
                        app.edit.data.city_ecode = $(data.elem).find("option[value='"+data.value+"']").attr('data-code');;
                        app.edit.data.site_eid = data.value;
                    }
                });

                form.on('submit(*)', function (data) {
                    if(app.edit.data.site_sid == 0){
                        layer.msg("请选择起始站点!", {icon: 5});
                        return false;
                    }
                    if(app.edit.data.site_eid == 0){
                        layer.msg("请选择终点站点!", {icon: 5});
                        return false;
                    }
                    if(app.edit.data.site_sid == app.edit.data.site_eid){
                        layer.msg("起始站点和终点站点不能选择同一个站点!", {icon: 5});
                        return false;
                    }
                    var point_address=[];
                    for (const dataKey in data.field) {
                        if(dataKey.includes('point_address[')){
                            point_address.push(data.field[dataKey]);
                        }
                    }
                    var point_address_s=[];
                    for (const dataKey in data.field) {
                        if(dataKey.includes('point_address_s[')){
                            point_address_s.push(data.field[dataKey]);
                        }
                    }
                    app.edit.data.name = data.field.name;
                    app.edit.data.serial_number = data.field.serial_number;
                    app.edit.data.e_address = data.field.e_address;
                    app.edit.data.s_address = data.field.s_address;
                    app.edit.data.point_address = point_address;
                    app.edit.data.point_address_s = point_address_s;
                    app.edit.data.duration = data.field.duration;
                    app.edit.data.mileage = data.field.mileage;
                    app.edit.data.rebate_type = data.field.rebate_type;
                    app.edit.data.rebate = data.field.rebate;
                    app.save();
                    return false;
                });

                this.obj = form;
            },
            render: function () {
                this.obj.render();
            }
        },
        save:function () {
            $.post(baseUrl+'&action=save',this.edit.data,function (d) {
                if(d.flag)
                {
                    layer.closeAll();
                    layer.msg(d.msg);
                    $('#data-list').table();
                }else{
                    layer.msg(d.msg);
                }
            },'json')
        },
        del:function (id) {
            layer.msg("确定删除该线路吗？", {
                time: false, //20s后自动关闭
                btn: ['确定', '取消'],
                yes:function () {
                    $.post(baseUrl+'&action=del',{id:id},function (d) {
                        layer.closeAll();
                        if(d.flag)
                        {
                            layer.msg('删除成功');
                            $('#data-list').table();
                        }else{
                            layer.msg(d.msg);
                        }
                    },'json')
                }
            });
        },
        tag:{
            data:{
                id:0,
                name:'',
                circuit_id:0,
                sort:0
            },
            list:{},
            index:0,
            delindex:0,
            is_update:0,
            init:function(){
                $(".tag-box").html(template("tpl-tag-list",{item:app.tag.list}));
            },
            info:function(id){
                $.post(baseUrl+'&action=tag_info',{id:id},function (d) {
                    if(d.flag){
                        layer.open({
                            title:false,
                            area:['430px','550px'],
                            type:1,
                            content:template('tpl-tag', {circuit_id:id}),
                            cancel: function(index, layero){
                                layer.closeAll();
                                if(app.tag.is_update == 1){
                                    $('#data-list').table();
                                }
                            }
                        });
                        app.tag.list = d.data;
                        app.tag.init();
                    }
                },'json')
            },
            edit:function(id,circuit_id){
                if(id != 0){
                    $.each(app.tag.list,function(index,value){
                        if(value.id == id){
                            app.tag.data = value;
                        }
                    });
                }else{
                    app.tag.data = {
                        id:0,
                        name:'',
                        circuit_id:circuit_id,
                        sort:0
                    };
                }
                app.tag.index = layer.open({
                    title:false,
                    area:['300px','300px'],
                    type:1,
                    content:template('tpl-tag-save', app.tag.data)
                });

                app.form.obj.on('submit(tag)',function(data){
                    app.tag.data.name = data.field.name;
                    app.tag.data.sort = data.field.sort;
                    app.tag.save();
                    return false;
                });
                app.form.render();
            },
            save:function(){
                $.post(baseUrl+'&action=tag_save',app.tag.data,function (d) {
                    if(d.flag)
                    {
                        app.tag.list = d.data;
                        app.tag.is_update = 1;
                        app.tag.init();
                        layer.close(app.tag.index);
                        layer.msg(d.msg);
                    }else{
                        layer.msg(d.msg);
                    }
                },'json')
            },
            del:function(id){
                app.tag.delindex = layer.msg("确定删除该标签吗？", {
                    time: false, //20s后自动关闭
                    btn: ['确定', '取消'],
                    yes:function () {
                        $.post(baseUrl+'&action=tag_del',{id:id},function (d) {
                            layer.close(app.tag.delindex);
                            if(d.flag)
                            {
                                $.each(app.tag.list,function(index,value){
                                    if(value.id == id){
                                        app.tag.list.splice(index,1);
                                    }
                                });
                                layer.msg('删除成功');
                                app.tag.is_update = 1;
                                app.tag.init();
                            }else{
                                layer.msg(d.msg);
                            }
                        },'json')
                    }
                });
            }
        },
        state:function(id,status){
            var str = status==1 ? '停用' : '启用';
            layer.msg("确定要"+str+"该线路吗？", {
                time: false, //20s后自动关闭
                btn: ['确定', '取消'],
                yes:function () {
                    $.post(baseUrl+'&action=state',{id:id,status:status},function (d) {
                        layer.closeAll();
                        if(d.flag)
                        {
                            layer.msg(str+'成功');
                            $('#data-list').table();
                        }else{
                            layer.msg(d.msg);
                        }
                    },'json')
                }
            });
        },
        laydate:{
            obj:null,
            init:function(){
                layui.use('laydate', function(){
                    app.laydate.obj = layui.laydate;
                });
            }
        },
        shift:{
            data:{
                id:0,
                circuit_id:0,
                ticket_price:'',
                a_ticket:0,
                s_ticket:0,
                min:1,
                max:0,
                carnum:0,
                inspector:0,
                models_id:0,
                presaletime:0,
                closingtime:0,
                type:''
            },
            moretime:[],
            issave:0,
            add:function(circuit_id,name){
                $.post(
                    baseUrl+'&action=list',{id:circuit_id,page: 1,limit: 1},function (d) {
                    if(!d.count)
                    {
                        layer.msg(d.msg);
                        layer.closeAll();
                        return false;
                    }else {
                        point_address_data=d.data.point_address;
                        var html='';
                        for (const ak in point_address_data) {
                            html+='<div class="layui-form-item" >'+
                                '<label class="layui-form-label">'+point_address_data[ak].name+'-发车时间</label>'+
                                '<div class="layui-input-inline" id="point_time_'+point_address_data[ak].id+'">'+
                            '</div>'+
                            '<div class="layui-form-mid layui-word-aux">设置途径点发车时间(需要先选择发车时间)</div>'+
                            '</div>';
                        }
                        $('#point_address').append(html);
                        app.form.render();
                    }
                },'json')
                app.shift.issave = 0;
                if(circuit_id != app.shift.data.circuit_id){
                    app.shift.data.ticket_price = '';
                    app.shift.data.a_ticket = 0;
                    app.shift.data.s_ticket = 0;
                    app.shift.data.min = 1;
                    app.shift.data.max = 0;
                    app.shift.data.carnum = 0;
                    app.shift.data.circuit_id = circuit_id;
                }
                app.shift.moretime = [];
                layer.open({
                    title:false,
                    area:['80%','70%'],
                    type:1,
                    content:template('tpl-shift-add', {name:name,item:app.shift.data})
                });
                app.laydate.obj.render({
                    elem: '#departureday'
                    ,range: '至'
                    ,min: '<?php echo date("Y-m-d"); ?>'
                });
                app.laydate.obj.render({
                    elem: '#departuretime'
                    ,type: 'time'
                    ,format: 'HH:mm'
                    ,btns:['confirm']
                    ,done: function(value, date){
                        for (const ak in point_address_data) {
                            var point_html='<input type="time" required lay-verify="required" name="point_times['+point_address_data[ak].id+'][]">&nbsp;&nbsp;';
                            $('#point_time_'+point_address_data[ak].id).append(point_html);
                        }
                        app.form.render();
                        app.shift.addmoretime(value)
                    }
                });

                app.form.obj.on('select(shift_type)',function(data){
                    app.shift.data.type = data.value;
                });
                app.form.obj.on('select(models_id)',function(data){
                    app.shift.data.models_id = data.value;
                });
                app.form.obj.on('select(inspector)',function(data){
                    app.shift.data.inspector = data.value;
                });
                app.form.obj.on('submit(shift)', function (data) {
                    if(app.shift.issave == 1){
                        layer.msg("正在保存数据,请勿重复提交", {icon: 5});
                        return false;
                    }
                    if(data.field.ticket_price == 0 ){
                        layer.msg("请输入大于0的价格!", {icon: 5});
                        return false;
                    }
                    if(app.shift.data.type==''){
                        layer.msg("请选择班次类型!", {icon: 5});
                        return false;
                    }
                    /*if(app.shift.data.models_id==''){
                        layer.msg("请选择车型!", {icon: 5});
                        return false;
                    }
                    if(app.shift.data.inspector == ''){
                        layer.msg("请选择检票员!", {icon: 5});
                        return false;
                    }*/
                    if(data.field.presaletime*60<=data.field.closingtime){
                        layer.msg("开始预售时间设定不能小于开始停售!", {icon: 5});
                        return false;
                    }
                    var departureday = $("#departureday").val();
                    if( departureday == ''){
                        layer.msg("请选择出发日期!", {icon: 5});
                        return false;
                    }
                    if(app.shift.moretime.length==0){
                        layer.msg("请选择发车时间!", {icon: 5});
                        return false;
                    }
                    app.shift.data.departureday = departureday;
                    app.shift.data.moretimestr = JSON.stringify(app.shift.moretime);
                    app.shift.data.presaletime = data.field.presaletime;
                    app.shift.data.closingtime = data.field.closingtime;
                    app.shift.data.ticket_price = data.field.ticket_price;
                    app.shift.data.a_ticket = data.field.a_ticket;
                    app.shift.data.s_ticket = data.field.s_ticket;
                    app.shift.data.min = data.field.min;
                    app.shift.data.max = data.field.max;
                    app.shift.data.carnum = data.field.carnum;
                    app.shift.data.ismore = 1;
                    app.shift.issave = 1;
                    var point_times =[];
                    for (const d_k in data.field) {
                        for (const p_k in point_address_data) {
                            if (d_k.includes('point_times['+point_address_data[p_k].id+']')) {
                                if(point_times[point_address_data[p_k].id]===undefined){
                                    point_times[point_address_data[p_k].id]={
                                        'id':point_address_data[p_k].id,
                                        'time':[
                                            data.field[d_k]
                                        ]
                                    };
                                }else {
                                    point_times[point_address_data[p_k].id].time.push(data.field[d_k]);
                                }
                            }
                        }
                    }
                    var point_times_data= point_times
                        .filter(item => item !== undefined) // 去除undefined的元素
                        .map(item => {
                            return item; // 为每个元素分配新的下标
                        });

                    app.shift.data.point_times=point_times_data;
                    app.shift.save();
                    return false;
                });
                app.form.render();
            },
            addmoretime:function(time){
                if(time == ''){
                    layer.msg("选发车时间!", {icon: 5});
                    return false;
                }else{
                    $("#departuretime").val('');
                }
                var has = 0;
                $.each(app.shift.moretime,function(index,value){
                    if(value == time){
                        has = 1;
                    }
                });
                if(has == 0){
                    app.shift.moretime.push(time);
                }else{
                    layer.msg("该发车时间已存在!", {icon: 5});
                    return false;
                }
                var html = template("tpl-moretime",{time:time})
                $(".moretimebox").append(html);
                $(".allmoretimebox").show();
            },
            delmoretime:function(e,time){
                $.each(app.shift.moretime,function(index,value){
                    if(value == time){
                        app.shift.moretime.splice(index,1);
                    }
                });
                $(e).parent(".moretime_box").remove();
                for (const ak in point_address_data) {
                    $('#point_time_'+point_address_data[ak].id+' input:last').remove()
                }
                app.form.render();
                if(app.shift.moretime.length==0){
                    $(".allmoretimebox").hide();
                }
            },
            save:function(){
                $.post("<?php echo $shiftUrl; ?>?action=save",app.shift.data,function (d) {
                    if(d.flag)
                    {
                        layer.closeAll();
                        layer.msg(d.msg);
                    }else{
                        layer.msg(d.msg);
                    }
                    app.shift.issave = 0;
                },'json')
            }
        },
        order:function(id){
            $.post(baseUrl+"&action=order",{id:id},function (d) {
                if(d.flag)
                {
                    layer.open({
                        title:false,
                        area:['80%','300PX'],
                        type:1,
                        content:template('tpl-order', {}),
                        success: function(layero, index){
                            var height = $("#layui-layer" + index).height()-50;
                            var width = $("#layui-layer" + index).width()-50;
                            $("#layui-layer" + index +" #order-box").attr("style","height:"+height+"px;width:"+width+"px;margin-left:25px;margin-top:25px;");
                            var option = {
                                tooltip: {
                                    trigger: 'axis',
                                    axisPointer: {
                                        type: 'cross',
                                        crossStyle: {
                                            color: '#999'
                                        }
                                    }
                                },
                                toolbox: {
                                    feature: {
                                        dataView: {show: true, readOnly: false},
                                        magicType: {show: true, type: ['line', 'bar']},
                                        restore: {show: true},
                                        saveAsImage: {show: true}
                                    }
                                },
                                legend: {
                                    data: d.data.name
                                },
                                xAxis: [
                                    {
                                        type: 'category',
                                        data: d.data.name,
                                        axisPointer: {
                                            type: 'shadow'
                                        }
                                    }
                                ],
                                yAxis: [
                                    {
                                        type: 'value',
                                        name: '笔',
                                        min: 0,
                                        axisLabel: {
                                            formatter: '{value}'
                                        }
                                    }
                                ],
                                series: d.data.data
                            };
                            echarts.init(document.getElementById('order-box')).setOption(option);
                        }
                    });
                }else{
                    layer.msg(d.msg);
                }
            },'json')
        },
        get_on:function (){
            i++;
            var option='';
            for (const key in app.site_data) {
                option+='<option data-site="'+app.site_data[key].id+'" value="'+app.site_data[key].id+'">'+app.site_data[key].name+'</option>';
            }
            var html='<div class="layui-input-block" id="get_one_'+i+'">'+
                '<select name="point_address['+i+']" lay-verify="required" lay-search >'+
                '<option value="">请选择一个站点</option>'+
                option+
                '</select>'+
                '<input type="text" name="point_address_s['+i+']"  value="" lay-verify="required"  autocomplete="off" placeholder="请输入途径点上车的地址" class="layui-input">'+
                '<a  class="layui-btn layui-btn-xs get_del" onclick="app.get_del('+i+')"  >删除途径点</a>'+
                '</div>';
            $('#get_on').append(html);
            app.form.render();
        },
        get_del:function (i){
            $('#get_one_'+i).remove();
            app.form.render();
        }
    };

    app.init();
</script>